var Mock = require('mockjs')

let hotsearch = require('./hotsearch.json')
let foodclass = require("./foodclass.json")
let homedishes = require("./homedishes.json")
let nextmeal = require("./nextmeal.json")
let type = require("./type.json")
let sesameaoil = require('./sesameoil.json')
let oliveoil = require('./oliveoil.json')
let guoshu = require('./guoshu.json')
let qiju = require('./qiju.json')
let tuijian = require('./tuijian.json')
let mofei = require('./mofei.json')
let eatforone = require('./eatforone.json')
let soupfood = require('./soupfood.json')
let meat = require('./meat.json')
let breakfast = require('./breakfast.json')
let baking = require('./baking.json')
let lanrenshipu = require('./lanrenshipu.json')
let kuaishoucai = require('./kuaishoucai.json')
let yuxiashuichan = require('./yuxiashuichan.json')
let jidan = require('./jidan')
let xiandan = require('./xiandan')
let doufu = require('./doufu')
let hongdou = require('./hongdou')
let shuiguo = require('./shuiguo.json')
let la = require('./la.json')
let gali = require('./gali.json')
let yuanxiaojie = require('./yuanxaiojie.json')
let liujinguo = require('./liujinguo.json')
let dibolang = require('./dibolang.json')
let meixiangyun = require('./meixiangyun.json')
let meixiangyun2 = require('./meixiangyun2.json')
Mock.mock('/api/lableMap', 'get', {
    status: 0,
    msg: '',
    data: {
        data: {
            '0': '家',
            '1': '公司',
            '2': '其他'
        }
    }
})

Mock.mock('/api/getdish', "post", function (options) {
    console.log(options);
    let name = JSON.parse(options.body).params.name;
    switch (name) {
        case "家常菜":
            return homedishes;
        case "下饭菜":
            return nextmeal;
        case "一人食":
            return eatforone;
        case "汤粥主食":
            return soupfood;
        case "肉类":
            return meat;
        case "早餐":
            return breakfast;
        case "烘焙":
            return baking;
        case "懒人食谱":
            return lanrenshipu
        case "快手菜":
            return kuaishoucai
        case "鱼虾水产":
            return yuxiashuichan;
        case "水果":
            return shuiguo;
        default:
            return {};
    }
})

Mock.mock("/api/gethots", 'get', {
    status: 0,
    msg: '',
    data: {
        hots: hotsearch
    }
})

Mock.mock("/api/getfood", 'get', {
    status: 0,
    msg: '',
    data: {
        food: foodclass
    }
})

// Mock.mock("/api/getgoodcontent", 'get', {
//     status: 0,
//     msg: '',
//     data: {
//        good:mofei
//     }
// })
Mock.mock('/api/getgoodcontent', "post", function (options) {
    console.log(options);
    let name = JSON.parse(options.body).params.name;
    // console.log(name)
    switch (name) {
        case "摩飞 | 【领券立减70，到手358】砧板刀具筷子消du机二代":
            return mofei;
        case "Cocaba | 鎏金系列不粘深煎锅煎炒锅 24cm/26cm/28cm三规格(带盖+赠榉木铲)":
            return liujinguo;
        case "帝伯朗 | 陶瓷煎锅 20cm  多色可选":
            return dibolang;
        case "【现货申通】梅乡韵 I 梅酒省心套装  胭脂梅+黄梅+米酒+黄冰糖  完熟梅酒/胭脂梅酒/套装组合":
            return meixiangyun;
        case "【现货申通】梅乡韵 I 福建诏安  新鲜青梅  2斤/5斤 现摘酸梅子 泡青梅酒/咸水梅/青梅汁/酵素":
            return meixiangyun2;

            // default:
            //     return {};
    }
})

Mock.mock('/api/getfoods', "post", function (options) {
    console.log(options);
    let name = JSON.parse(options.body).params.name;
    switch (name) {
        case "香油":
            return sesameaoil;
        case "橄榄油":
            return oliveoil;

        case "鸡蛋":
            return jidan;
        case "咸蛋":
            return xiandan;
        case "豆腐":
            return doufu;
        case "红豆":
            return hongdou;
        case "咖喱":
            return gali;
        case "辣":
            return la;
        case "元宵节":
            return yuanxiaojie
        default:
            return {};
    }
})

Mock.mock('/api/gettype', 'get', {
    status: 0,
    msg: '',
    data: {
        typelist: type
    }
})

Mock.mock('/api/getfoodtype', "post", function (options) {
    let name = JSON.parse(options.body).params.name;
    switch (name) {
        case "推荐":
            return tuijian
        case "果蔬":
            return guoshu;
        case "器具":
            return qiju;
        default:
            return {};
    }

})